#define _CRT_SECURE_NO_WARNINGS
int maxDepth(struct TreeNode* root) {
    if (root == NULL)
        return 0;


    int leftheight = maxDepth(root->left);
    int rightheight = maxDepth(root->right);


    return leftheight > rightheight ? leftheight + 1 : rightheight + 1;
}


bool isUnivalTree(struct TreeNode* root) {
    if (root == NULL)
        return true;
    if (root->left && root->left->val != root->val)
        return false;
    if (root->right && root->right->val != root->val)
        return false;
    return isUnivalTree(root->left) && isUnivalTree(root->right);
}